/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 jfinal app. jfapp Group.
 */

define(['adminapp'], function ($app) {
    $app.navactive('table_category');

    var statustpl = Handlebars.compile($("#status_tpl").html());
    var actiontpl = Handlebars.compile($("#action_template").html());

    var $listtable = $app.listtable({
        'sAjaxSource' : g.ctx + "admin/booking/tableCategory/list",
        'fnServerParams': function( aoData){
            var sd = $('#search_form').serializeJSON();
            $.each(sd, function(name, val){
                aoData.push({"name": name, "value": val});
            });
        },
        'aoColumns'   : [
            $app.checkall,
            $app.autono,
            {'mDataProp': 'name' },
            {'mDataProp': 'create_time' },
            {'mDataProp': 'status' },
            {'mDataProp': 'remark' }
        ],
        'aoColumnDefs': [
            {
                'aTargets': [4],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return statustpl(full);
                }
            },
            {
                'aTargets': [6],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return actiontpl(full);
                }
            }
        ]
    }, 'data-list');
});

